<!doctype html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="generator" content="Docusaurus v2.0.0-alpha.72">
<link rel="alternate" type="application/rss+xml" href="/zh-cn.neutralinojs.github.io/blog/rss.xml" title="Neutralinojs Blog RSS Feed">
<link rel="alternate" type="application/atom+xml" href="/zh-cn.neutralinojs.github.io/blog/atom.xml" title="Neutralinojs Blog Atom Feed">
<link rel="preconnect" href="https://www.google-analytics.com">
<link rel="preconnect" href="https://www.googletagmanager.com">
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-120983955-1"></script>
<script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","UA-120983955-1",{anonymize_ip:!0})</script>
<script src="https://media.ethicalads.io/media/client/ethicalads.min.js"></script>
<script src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js" async></script><title data-react-helmet="true">neutralino.config.json | Neutralinojs</title><meta data-react-helmet="true" property="og:url" content="https://wll8.gitee.io/zh-cn.neutralinojs.github.io/zh-cn.neutralinojs.github.io/docs/configuration/neutralino.config.json"><meta data-react-helmet="true" name="docusaurus_locale" content="en"><meta data-react-helmet="true" name="docusaurus_version" content="current"><meta data-react-helmet="true" name="docusaurus_tag" content="docs-default-current"><meta data-react-helmet="true" property="og:title" content="neutralino.config.json | Neutralinojs"><meta data-react-helmet="true" name="description" content="neutralino.config.json 文件包含了应用程序的配置详情。每个 Neutralinojs 应用都需要配置文件中的以下强制键值。"><meta data-react-helmet="true" property="og:description" content="neutralino.config.json 文件包含了应用程序的配置详情。每个 Neutralinojs 应用都需要配置文件中的以下强制键值。"><link data-react-helmet="true" rel="shortcut icon" href="/zh-cn.neutralinojs.github.io/img/favicon.png"><link data-react-helmet="true" rel="canonical" href="https://wll8.gitee.io/zh-cn.neutralinojs.github.io/zh-cn.neutralinojs.github.io/docs/configuration/neutralino.config.json"><link data-react-helmet="true" rel="alternate" href="https://wll8.gitee.io/zh-cn.neutralinojs.github.io/zh-cn.neutralinojs.github.io/docs/configuration/neutralino.config.json" hreflang="en"><link data-react-helmet="true" rel="alternate" href="https://wll8.gitee.io/zh-cn.neutralinojs.github.io/zh-cn.neutralinojs.github.io/docs/configuration/neutralino.config.json" hreflang="x-default"><link rel="stylesheet" href="/zh-cn.neutralinojs.github.io/assets/css/styles.b7ecac1c.css">
<link rel="preload" href="/zh-cn.neutralinojs.github.io/assets/js/styles.c25d7c9f.js" as="script">
<link rel="preload" href="/zh-cn.neutralinojs.github.io/assets/js/runtime~main.da1bdab8.js" as="script">
<link rel="preload" href="/zh-cn.neutralinojs.github.io/assets/js/main.22927eab.js" as="script">
<link rel="preload" href="/zh-cn.neutralinojs.github.io/assets/js/1.a80d899d.js" as="script">
<link rel="preload" href="/zh-cn.neutralinojs.github.io/assets/js/2.818fc9a7.js" as="script">
<link rel="preload" href="/zh-cn.neutralinojs.github.io/assets/js/49.8e895b96.js" as="script">
<link rel="preload" href="/zh-cn.neutralinojs.github.io/assets/js/50.816652b0.js" as="script">
<link rel="preload" href="/zh-cn.neutralinojs.github.io/assets/js/935f2afb.a67ede05.js" as="script">
<link rel="preload" href="/zh-cn.neutralinojs.github.io/assets/js/17896441.74f92a0c.js" as="script">
<link rel="preload" href="/zh-cn.neutralinojs.github.io/assets/js/dffd476c.dd877da1.js" as="script">
</head>
<body>
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus">
<div><a href="#main" class="skipToContent_1oUP">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Navigation bar toggle" class="navbar__toggle" type="button" tabindex="0"><svg aria-label="Menu" width="30" height="30" viewBox="0 0 30 30" role="img" focusable="false"><title>Menu</title><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/zh-cn.neutralinojs.github.io/"><img src="/zh-cn.neutralinojs.github.io/img/logo.png" alt="Neutralinojs Logo" class="themedImage_1VuW themedImage--light_3UqQ navbar__logo"><img src="/zh-cn.neutralinojs.github.io/img/logo.png" alt="Neutralinojs Logo" class="themedImage_1VuW themedImage--dark_hz6m navbar__logo"><strong class="navbar__title">Neutralinojs</strong></a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/zh-cn.neutralinojs.github.io/docs/">文档</a><a class="navbar__item navbar__link" href="/zh-cn.neutralinojs.github.io/apps/">应用</a><a class="navbar__item navbar__link" href="/zh-cn.neutralinojs.github.io/resources/">资源</a><a href="https://www.youtube.com/c/CodeZri" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">视频</a><a href="https://codezri.org/blog/neutralinojs-2024-roadmap" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">路线图</a><a class="navbar__item navbar__link" href="/zh-cn.neutralinojs.github.io/docs/release-notes/framework">发布说明</a><a href="https://github.com/neutralinojs/gsoc2024" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GSoC 2024</a></div><div class="navbar__items navbar__items--right"><a href="https://github.com/neutralinojs" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub</a><a href="https://www.patreon.com/shalithasuranga" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">❤️ 捐赠</a><div class="react-toggle react-toggle--disabled displayOnlyInLargeViewport_GrZ2"><div class="react-toggle-track"><div class="react-toggle-track-check"><span class="toggle_71bT">🌜</span></div><div class="react-toggle-track-x"><span class="toggle_71bT">🌞</span></div></div><div class="react-toggle-thumb"></div><input type="checkbox" disabled="" aria-label="Dark mode toggle" class="react-toggle-screenreader-only"></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div><div class="navbar-sidebar"><div class="navbar-sidebar__brand"><a class="navbar__brand" href="/zh-cn.neutralinojs.github.io/"><img src="/zh-cn.neutralinojs.github.io/img/logo.png" alt="Neutralinojs Logo" class="themedImage_1VuW themedImage--light_3UqQ navbar__logo"><img src="/zh-cn.neutralinojs.github.io/img/logo.png" alt="Neutralinojs Logo" class="themedImage_1VuW themedImage--dark_hz6m navbar__logo"><strong class="navbar__title">Neutralinojs</strong></a></div><div class="navbar-sidebar__items"><div class="menu"><ul class="menu__list"><li class="menu__list-item"><a aria-current="page" class="menu__link navbar__link--active" href="/zh-cn.neutralinojs.github.io/docs/">文档</a></li><li class="menu__list-item"><a class="menu__link" href="/zh-cn.neutralinojs.github.io/apps/">应用</a></li><li class="menu__list-item"><a class="menu__link" href="/zh-cn.neutralinojs.github.io/resources/">资源</a></li><li class="menu__list-item"><a href="https://www.youtube.com/c/CodeZri" target="_blank" rel="noopener noreferrer" class="menu__link">视频</a></li><li class="menu__list-item"><a href="https://codezri.org/blog/neutralinojs-2024-roadmap" target="_blank" rel="noopener noreferrer" class="menu__link">路线图</a></li><li class="menu__list-item"><a class="menu__link" href="/zh-cn.neutralinojs.github.io/docs/release-notes/framework">发布说明</a></li><li class="menu__list-item"><a href="https://github.com/neutralinojs/gsoc2024" target="_blank" rel="noopener noreferrer" class="menu__link">GSoC 2024</a></li><li class="menu__list-item"><a href="https://github.com/neutralinojs" target="_blank" rel="noopener noreferrer" class="menu__link">GitHub</a></li><li class="menu__list-item"><a href="https://www.patreon.com/shalithasuranga" target="_blank" rel="noopener noreferrer" class="menu__link">❤️ 捐赠</a></li></ul></div></div></div></nav><div class="main-wrapper main-docs-wrapper"><div class="docPage_31aa"><div class="docSidebarContainer_3Kbt" role="complementary"><div class="sidebar_15mo"><div class="menu menu--responsive thin-scrollbar menu_Bmed"><button aria-label="Open menu" aria-haspopup="true" class="button button--secondary button--sm menu__button" type="button"><svg aria-label="Menu" class="sidebarMenuIcon_fgN0" width="24" height="24" viewBox="0 0 30 30" role="img" focusable="false"><title>Menu</title><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><ul class="menu__list"><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">入门指南</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/">简介</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/getting-started/your-first-neutralinojs-app">您的第一个Neutralinojs应用</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/getting-started/using-frontend-libraries">使用前端库</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">原生 API</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/overview">原生API概览</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/app">Neutralino.app</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/clipboard">Neutralino.clipboard</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/computer">Neutralino.computer</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/custom">Neutralino.custom</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/debug">Neutralino.debug</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/events">Neutralino.events</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/extensions">Neutralino.extensions</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/filesystem">Neutralino.filesystem</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/init">Neutralino.init</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/os">Neutralino.os</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/storage">Neutralino.storage</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/updater">Neutralino.updater</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/window">Neutralino.window</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/error-codes">错误码</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/api/global-variables">全局变量</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">CLI</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/cli/neu-cli">neu CLI</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/cli/internal-cli-arguments">Internal 命令行参数</a></li></ul></li><li class="menu__list-item"><a class="menu__link menu__link--sublist menu__link--active" href="#!">配置</a><ul class="menu__list"><li class="menu__list-item"><a aria-current="page" class="menu__link menu__link--active active" tabindex="0" href="/zh-cn.neutralinojs.github.io/docs/configuration/neutralino.config.json">neutralino.config.json</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/zh-cn.neutralinojs.github.io/docs/configuration/project-structure">项目结构</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/zh-cn.neutralinojs.github.io/docs/configuration/modes">模式</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">如何操作</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/how-to/extensions-overview">扩展概述</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/how-to/auto-updater">自动更新器</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">分发</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/distribution/overview">分发概述</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">贡献</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/contributing/framework-developer-guide">框架开发指南</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/contributing/architecture">架构</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/contributing/security">安全性</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/contributing/code-style-guide">代码风格指南</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/contributing/developer-support">开发者支持</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/contributing/committers">提交者</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/contributing/frequently-asked-questions">常见问题解答</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/contributing/about-neutralinojs">关于 Neutralinojs</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">发布说明</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/release-notes/framework">框架</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/release-notes/cli">命令行</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/zh-cn.neutralinojs.github.io/docs/release-notes/client-library">客户端</a></li></ul></li></ul></div></div></div><main class="docMainContainer_3ufF"><div class="container padding-vert--lg docItemWrapper_3FMP"><div class="row"><div class="col docItemCol_2rXS"><div class="docItemContainer_1EXp"><article><header><h1 class="docTitle_1vX4">neutralino.config.json</h1></header><div class="markdown"><p><code>neutralino.config.json</code> 文件包含了应用程序的配置详情。每个 Neutralinojs 应用都需要配置文件中的以下强制键值。</p><ul><li><code>applicationId</code></li><li><code>url</code></li><li><code>defaultMode</code></li></ul><p>其他配置属性是可选的，并且可能有默认值。</p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="primary"></a>Primary<a class="hash-link" href="#primary" title="Direct link to heading">#</a></h2><p>以下配置值在不同的 Neutralinojs 模式下不能被覆盖。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="applicationid-string"></a><code>applicationId: string</code><a class="hash-link" href="#applicationid-string" title="Direct link to heading">#</a></h3><p>用于识别您的应用程序的唯一字符串。例如：<code>js.neutralino.sample</code></p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="version-string"></a><code>version: string</code><a class="hash-link" href="#version-string" title="Direct link to heading">#</a></h3><p>应用程序版本。例如：<code>2.4.22</code></p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="defaultmode-string"></a><code>defaultMode: string</code><a class="hash-link" href="#defaultmode-string" title="Direct link to heading">#</a></h3><p>应用程序的模式。可接受的值有 <code>window</code>、<code>browser</code> 和 <code>cloud</code>。</p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="general"></a>General<a class="hash-link" href="#general" title="Direct link to heading">#</a></h2><p>您可以在不同模式下覆盖以下配置值。例如，您可以在根级别使用特定的 URL，又在窗口模式级别使用另一个 URL，如下所示。</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly json"><div tabindex="0" class="prism-code language-json codeBlock_23N8 thin-scrollbar"><div class="codeBlockLines_39YC" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token property">&quot;url&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;/&quot;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token property">&quot;modes&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        </span><span class="token property">&quot;window&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">            </span><span class="token property">&quot;url&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;/#window-mode&quot;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o">Copy</button></div></div><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="port-number"></a><code>port: number</code><a class="hash-link" href="#port-number" title="Direct link to heading">#</a></h3><p>您的应用程序的端口。如果值是 <code>0</code>，Neutralinojs 将使用一个随机可用的端口。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="enableserver-boolean"></a><code>enableServer: boolean</code><a class="hash-link" href="#enableserver-boolean" title="Direct link to heading">#</a></h3><p>启用或禁用后台服务器（禁用静态文件服务功能和原生 API 消息传递）。
如果您加载远程 URL 到 webview，您可以将此选项设置为 <code>false</code>。确保如果您从本地资源加载资源，设置此选项为 <code>true</code>。默认值是 <code>false</code>。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="enablenativeapi-boolean"></a><code>enableNativeAPI: boolean</code><a class="hash-link" href="#enablenativeapi-boolean" title="Direct link to heading">#</a></h3><p>启用或禁用原生 API。如果您想使用任何原生 API 功能，您可以将此选项设置为 <code>true</code>。默认值是 <code>false</code>。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="tokensecurity-string"></a><code>tokenSecurity: string</code><a class="hash-link" href="#tokensecurity-string" title="Direct link to heading">#</a></h3><p>Neutralinojs 使用带有本地 WebSocket 的客户端-服务器通信模式处理原生调用。
这个本地服务器通过自动生成的令牌得到保护。此选项定义了 token 的安全实现。</p><p>接受以下值：</p><ul><li><p><code>one-time</code> <strong>(推荐)</strong>：服务器只发送一次访问令牌，客户端在 <code>sessionStorage</code> 中持久化它。如果另一个客户端（例如：浏览器）尝试访问应用，将显示 <code>NE_RT_INVTOKN</code> 错误消息，而不是应用程序。建议使用这个选项，因为它可以减少安全问题。</p></li><li><p><code>none</code>：服务器总是发送访问令牌，所以任何新客户端都可以看到应用程序。</p></li></ul><p>如果开发者没有指定此设置，默认值变为 <code>one-time</code>。</p><div class="admonition admonition-danger alert alert--danger"><div class="admonition-heading"><h5><span class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="16" viewBox="0 0 12 16"><path fill-rule="evenodd" d="M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"></path></svg></span>danger</h5></div><div class="admonition-content"><p>如果您使用可以访问您电脑内部的原生 APIs，如 <code>os</code>、<code>filesystem</code> 模块，则不要使用 <code>none</code> 选项，因为任何新客户端都可以使用这些 APIs。</p></div></div><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="url-string"></a><code>url: string</code><a class="hash-link" href="#url-string" title="Direct link to heading">#</a></h3><p>应用程序的入口 URL。Neutralinojs 将最初加载这个 URL。
此属性接受相对和绝对 URL。看以下示例。</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly json"><div tabindex="0" class="prism-code language-json codeBlock_23N8 thin-scrollbar"><div class="codeBlockLines_39YC" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token property">&quot;url&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;/&quot;</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o">Copy</button></div></div><p>上面的配置最初加载 <code>http://localhost:&lt;port&gt;/</code> URL（内部加载 <code>/index.html</code>）。
您也可以使用远程 urls。</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly json"><div tabindex="0" class="prism-code language-json codeBlock_23N8 thin-scrollbar"><div class="codeBlockLines_39YC" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token property">&quot;url&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;http://example.com&quot;</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o">Copy</button></div></div><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="documentroot-string"></a><code>documentRoot: string</code><a class="hash-link" href="#documentroot-string" title="Direct link to heading">#</a></h3><p>为静态服务器设置文档根目录。例如，如果您需要使用 <code>resources</code> 目录作为
文档根目录，您可以如下设置 <code>documentRoot</code>。</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly json"><div tabindex="0" class="prism-code language-json codeBlock_23N8 thin-scrollbar"><div class="codeBlockLines_39YC" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token property">&quot;documentRoot&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;/resources/&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token property">&quot;url&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;/&quot;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o">Copy</button></div></div><p>确保与文档根目录正确配置 <code>url</code>。以下配置是 <strong>错误的</strong>，它指示静态服务器从 <code>./resources/resources</code> 获取资源。</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly json"><div tabindex="0" class="prism-code language-json codeBlock_23N8 thin-scrollbar"><div class="codeBlockLines_39YC" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token property">&quot;documentRoot&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;/resources/&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token property">&quot;url&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;/resources/&quot;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o">Copy</button></div></div><p>然而，您可以在 URL 中使用子目录，如下所示。</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly json"><div tabindex="0" class="prism-code language-json codeBlock_23N8 thin-scrollbar"><div class="codeBlockLines_39YC" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token property">&quot;documentRoot&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;/&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token property">&quot;url&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;/resources/&quot;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o">Copy</button></div></div><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="exportauthinfo-boolean"></a><code>exportAuthInfo: boolean</code><a class="hash-link" href="#exportauthinfo-boolean" title="Direct link to heading">#</a></h3><p>将验证详情导出到 <code>${NL_PATH}/.tmp/auth_info.json</code> 文件，其 JSON 结构如下。</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly json"><div tabindex="0" class="prism-code language-json codeBlock_23N8 thin-scrollbar"><div class="codeBlockLines_39YC" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token property">&quot;port&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;&lt;port&gt;&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token property">&quot;accessToken&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;&lt;access_token&gt;&quot;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o">Copy</button></div></div><p>您可以使用上述验证详情通过使用 WebSocket 作为 IPC 机制从外部进程连接到 Neutralinojs。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="enableextensions-boolean"></a><code>enableExtensions: boolean</code><a class="hash-link" href="#enableextensions-boolean" title="Direct link to heading">#</a></h3><p>启用/禁用扩展。
了解更多关于此选项的信息 <a href="/zh-cn.neutralinojs.github.io/docs/how-to/extensions-overview#enable-the-extensions-feature">这里</a></p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="extensions-object"></a><code>extensions: object[]</code><a class="hash-link" href="#extensions-object" title="Direct link to heading">#</a></h3><p>扩展定义数组。
了解更多关于此选项的信息 <a href="/zh-cn.neutralinojs.github.io/docs/how-to/extensions-overview#defining-the-extensions">这里</a></p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="nativeblocklist-string"></a><code>nativeBlockList: string[]</code><a class="hash-link" href="#nativeblocklist-string" title="Direct link to heading">#</a></h3><p>需要从应用程序前端阻止的原生方法数组。在条目内部允许使用通配符 <code>*</code>。</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly json"><div tabindex="0" class="prism-code language-json codeBlock_23N8 thin-scrollbar"><div class="codeBlockLines_39YC" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token property">&quot;nativeBlockList&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">[</span><span class="token string" style="color:rgb(195, 232, 141)">&quot;os.execCommand&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">]</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token property">&quot;nativeBlockList&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">[</span><span class="token string" style="color:rgb(195, 232, 141)">&quot;app.*&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">]</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o">Copy</button></div></div><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="nativeallowlist-string"></a><code>nativeAllowList: string[]</code><a class="hash-link" href="#nativeallowlist-string" title="Direct link to heading">#</a></h3><p>需要从应用程序前端允许的原生方法数组。在条目内部允许使用通配符 <code>*</code>。</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly json"><div tabindex="0" class="prism-code language-json codeBlock_23N8 thin-scrollbar"><div class="codeBlockLines_39YC" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token property">&quot;nativeAllowList&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">[</span><span class="token string" style="color:rgb(195, 232, 141)">&quot;os.getEnv&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">]</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token property">&quot;nativeAllowList&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">[</span><span class="token string" style="color:rgb(195, 232, 141)">&quot;storage.*&quot;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">]</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o">Copy</button></div></div><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="globalvariables-object"></a><code>globalVariables: object</code><a class="hash-link" href="#globalvariables-object" title="Direct link to heading">#</a></h3><p>自定义 <a href="/zh-cn.neutralinojs.github.io/docs/api/global-variables#custom-global-variables">全局变量</a> 的基于键值的 JavaScript 对象。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="loggingenabled-boolean"></a><code>logging.enabled: boolean</code><a class="hash-link" href="#loggingenabled-boolean" title="Direct link to heading">#</a></h3><p>启用或禁用日志功能。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="loggingwritetologfile-boolean"></a><code>logging.writeToLogFile: boolean</code><a class="hash-link" href="#loggingwritetologfile-boolean" title="Direct link to heading">#</a></h3><p>启用或禁用日志文件。如果此设置是 <code>false</code>，框架不会将日志写入 <code>neutralinojs.log</code>，
它会将日志写入标准流。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="serverheaders-object"></a><code>serverHeaders: object</code><a class="hash-link" href="#serverheaders-object" title="Direct link to heading">#</a></h3><p>静态服务器和 WebSocket 握手过程的自定义头。例如，以下配置
会在每个传出 HTTP 响应中发送一个自定义头。</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly json"><div tabindex="0" class="prism-code language-json codeBlock_23N8 thin-scrollbar"><div class="codeBlockLines_39YC" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token property">&quot;serverHeaders&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">        </span><span class="token property">&quot;Test-Header-Option&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;Value&quot;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o">Copy</button></div></div><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="window-mode"></a>Window mode<a class="hash-link" href="#window-mode" title="Direct link to heading">#</a></h2><p>当应用程序以窗口模式运行时，将使用以下配置值。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeswindowtitle-string"></a><code>modes.window.title: string</code><a class="hash-link" href="#modeswindowtitle-string" title="Direct link to heading">#</a></h3><p>原生窗口的标题。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeswindowwidth-number"></a><code>modes.window.width: number</code><a class="hash-link" href="#modeswindowwidth-number" title="Direct link to heading">#</a></h3><p>原生窗口的宽度。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeswindowheight-number"></a><code>modes.window.height: number</code><a class="hash-link" href="#modeswindowheight-number" title="Direct link to heading">#</a></h3><p>原生窗口的高度。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeswindowminwidth-number"></a><code>modes.window.minWidth: number</code><a class="hash-link" href="#modeswindowminwidth-number" title="Direct link to heading">#</a></h3><p>原生窗口的最小宽度。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeswindowminheight-number"></a><code>modes.window.minHeight: number</code><a class="hash-link" href="#modeswindowminheight-number" title="Direct link to heading">#</a></h3><p>原生窗口的最小高度。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeswindowmaxwidth-number"></a><code>modes.window.maxWidth: number</code><a class="hash-link" href="#modeswindowmaxwidth-number" title="Direct link to heading">#</a></h3><p>原生窗口的最大宽度。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeswindowmaxheight-number"></a><code>modes.window.maxHeight: number</code><a class="hash-link" href="#modeswindowmaxheight-number" title="Direct link to heading">#</a></h3><p>原生窗口的最大高度。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeswindowx-number"></a><code>modes.window.x: number</code><a class="hash-link" href="#modeswindowx-number" title="Direct link to heading">#</a></h3><p>原生窗口的左位置（x）。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeswindowy-number"></a><code>modes.window.y: number</code><a class="hash-link" href="#modeswindowy-number" title="Direct link to heading">#</a></h3><p>原生窗口的右位置（y）。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeswindowcenter-boolean"></a><code>modes.window.center: boolean</code><a class="hash-link" href="#modeswindowcenter-boolean" title="Direct link to heading">#</a></h3><p>最初居中原生应用窗口。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeswindowfullscreen-boolean"></a><code>modes.window.fullScreen: boolean</code><a class="hash-link" href="#modeswindowfullscreen-boolean" title="Direct link to heading">#</a></h3><p>激活全屏模式。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeswindowicon-string"></a><code>modes.window.icon: string</code><a class="hash-link" href="#modeswindowicon-string" title="Direct link to heading">#</a></h3><p>应用程序图标的文件名。您可以直接指向资源目录中的图像文件。我们推荐您选择一个透明的 PNG 文件。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeswindowalwaysontop-boolean"></a><code>modes.window.alwaysOnTop: boolean</code><a class="hash-link" href="#modeswindowalwaysontop-boolean" title="Direct link to heading">#</a></h3><p>激活窗口最上层模式。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeswindowenableinspector-boolean"></a><code>modes.window.enableInspector: boolean</code><a class="hash-link" href="#modeswindowenableinspector-boolean" title="Direct link to heading">#</a></h3><p>自动打开开发者工具窗口。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeswindowborderless-boolean"></a><code>modes.window.borderless: boolean</code><a class="hash-link" href="#modeswindowborderless-boolean" title="Direct link to heading">#</a></h3><p>激活无边框模式。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeswindowmaximize-boolean"></a><code>modes.window.maximize: boolean</code><a class="hash-link" href="#modeswindowmaximize-boolean" title="Direct link to heading">#</a></h3><p>启动时最大化应用程序。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeswindowresizable-boolean"></a><code>modes.window.resizable: boolean</code><a class="hash-link" href="#modeswindowresizable-boolean" title="Direct link to heading">#</a></h3><p>设置窗口是否可调整大小。默认值是 <code>true</code>。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeswindowhidden-boolean"></a><code>modes.window.hidden: boolean</code><a class="hash-link" href="#modeswindowhidden-boolean" title="Direct link to heading">#</a></h3><p>使窗口不可见。此设置可用于开发后台服务。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeswindowexitprocessonclose-boolean"></a><code>modes.window.exitProcessOnClose: boolean</code><a class="hash-link" href="#modeswindowexitprocessonclose-boolean" title="Direct link to heading">#</a></h3><p>如果此设置是 <code>true</code>，当用户点击关闭按钮时，应用进程将退出。否则，
框架将分发 <code>windowClose</code> 事件。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeswindowusesavedstate-boolean"></a><code>modes.window.useSavedState: boolean</code><a class="hash-link" href="#modeswindowusesavedstate-boolean" title="Direct link to heading">#</a></h3><p>自动保存和加载主要窗口状态（宽度、高度、x、y 值和最大化状态）。
默认值是 <code>true</code>。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeswindowextenduseragentwith-string"></a><code>modes.window.extendUserAgentWith: string</code><a class="hash-link" href="#modeswindowextenduseragentwith-string" title="Direct link to heading">#</a></h3><p>用自定义后缀扩展默认特定于 webview 的用户代理字符串。如果没有设置这个值，
webview 将从平台特定的渲染引擎设置默认用户代理（即 GNU/Linux 上的 WebKit）。</p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="chrome-mode"></a>Chrome mode<a class="hash-link" href="#chrome-mode" title="Direct link to heading">#</a></h2><p>当应用程序以 chrome 模式启动时，将使用以下配置值。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeschromewidth-number"></a><code>modes.chrome.width: number</code><a class="hash-link" href="#modeschromewidth-number" title="Direct link to heading">#</a></h3><p>chrome 窗口的宽度。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeschromeheight-number"></a><code>modes.chrome.height: number</code><a class="hash-link" href="#modeschromeheight-number" title="Direct link to heading">#</a></h3><p>chrome 窗口的高度。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="modeschromeargs-string"></a><code>modes.chrome.args: string</code><a class="hash-link" href="#modeschromeargs-string" title="Direct link to heading">#</a></h3><p>Chrome 进程的附加命令行参数。从 <a href="/zh-cn.neutralinojs.github.io/docs/configuration/modes#chrome">这里</a> 了解更多关于 chrome 模式的信息。</p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="cli"></a>CLI<a class="hash-link" href="#cli" title="Direct link to heading">#</a></h2><p>以下配置值用于 neu CLI。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="clibinaryname-string"></a><code>cli.binaryName: string</code><a class="hash-link" href="#clibinaryname-string" title="Direct link to heading">#</a></h3><p>您应用程序的二进制文件名。如果是 <code>myapp</code>，所有二进制文件将使用
<code>myapp-&lt;platform&gt;_&lt;arch&gt;</code> 格式。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="cliresourcespath-string"></a><code>cli.resourcesPath: string</code><a class="hash-link" href="#cliresourcespath-string" title="Direct link to heading">#</a></h3><p>您应用程序资源的路径。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="cliextensionspath-string"></a><code>cli.extensionsPath: string</code><a class="hash-link" href="#cliextensionspath-string" title="Direct link to heading">#</a></h3><p>您应用程序扩展的路径。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="cliclientlibrary-string"></a><code>cli.clientLibrary: string</code><a class="hash-link" href="#cliclientlibrary-string" title="Direct link to heading">#</a></h3><p>Neutralinojs JavaScript 库的文件名。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="clibinaryversion-string"></a><code>cli.binaryVersion: string</code><a class="hash-link" href="#clibinaryversion-string" title="Direct link to heading">#</a></h3><p>Neutralinojs 服务器版本。通过使用 <code>nightly</code> 标签获取每晚构建版本。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="cliclientversion-string"></a><code>cli.clientVersion: string</code><a class="hash-link" href="#cliclientversion-string" title="Direct link to heading">#</a></h3><p>Neutralinojs 客户端版本。通过使用 <code>nightly</code> 标签获取每晚构建版本。</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="cliautoreloadexclude-string"></a><code>cli.autoReloadExclude: string</code><a class="hash-link" href="#cliautoreloadexclude-string" title="Direct link to heading">#</a></h3><p>一个 JavaScript 正则表达式，用于从自动重新加载文件监视器中排除文件。例如，以下配置将禁用 SASS 样式表（<code>.scss</code>）的自动重新加载。</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly json"><div tabindex="0" class="prism-code language-json codeBlock_23N8 thin-scrollbar"><div class="codeBlockLines_39YC" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token property">&quot;autoReloadExclude&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;.*\\.scss$&quot;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o">Copy</button></div></div><p>使用 <code>|</code> 字符设置多个正则表达式，如下所示。</p><div class="codeBlockContainer_K1bP"><div class="codeBlockContent_hGly json"><div tabindex="0" class="prism-code language-json codeBlock_23N8 thin-scrollbar"><div class="codeBlockLines_39YC" style="color:#bfc7d5;background-color:#292d3e"><div class="token-line" style="color:#bfc7d5"><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token property">&quot;autoReloadExclude&quot;</span><span class="token operator" style="color:rgb(137, 221, 255)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">&quot;.*\\.scss$|.*\\.less$&quot;</span><span class="token plain"></span></div><div class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_Ue-o">Copy</button></div></div><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_2LWZ" id="clifrontendlibrary-object"></a><code>cli.frontendLibrary: object</code><a class="hash-link" href="#clifrontendlibrary-object" title="Direct link to heading">#</a></h3><p>为 <code>neu run --frontend-lib-dev</code> 命令启用前端开发工具（HMR 等）。从 <a href="/zh-cn.neutralinojs.github.io/docs/getting-started/using-frontend-libraries">这里</a> 了解关于前端框架集成的更多信息。</p></div></article><div class="margin-vert--xl"><div class="row"><div class="col"><a href="https://github.com/neutralinojs/neutralinojs.github.io/edit/main/docs/configuration/neutralino.config.json.md" target="_blank" rel="noreferrer noopener"><svg fill="currentColor" height="1.2em" width="1.2em" preserveAspectRatio="xMidYMid meet" role="img" viewBox="0 0 40 40" class="iconEdit_2_ui" aria-label="Edit page"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div></div></div><div class="margin-vert--lg"><nav class="pagination-nav" aria-label="Docs pages navigation"><div class="pagination-nav__item"><a class="pagination-nav__link" href="/zh-cn.neutralinojs.github.io/docs/cli/internal-cli-arguments"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">« Internal 命令行参数</div></a></div><div class="pagination-nav__item pagination-nav__item--next"><a class="pagination-nav__link" href="/zh-cn.neutralinojs.github.io/docs/configuration/project-structure"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">项目结构 »</div></a></div></nav></div></div></div><div class="col col--3"><div class="tableOfContents_1nbE thin-scrollbar"><div><div data-ea-publisher="neutralino" data-ea-type="image" id="neutralino-docs"></div></div><ul class="table-of-contents table-of-contents__left-border"><li><a href="#primary" class="table-of-contents__link">Primary</a><ul><li><a href="#applicationid-string" class="table-of-contents__link"><code>applicationId: string</code></a></li><li><a href="#version-string" class="table-of-contents__link"><code>version: string</code></a></li><li><a href="#defaultmode-string" class="table-of-contents__link"><code>defaultMode: string</code></a></li></ul></li><li><a href="#general" class="table-of-contents__link">General</a><ul><li><a href="#port-number" class="table-of-contents__link"><code>port: number</code></a></li><li><a href="#enableserver-boolean" class="table-of-contents__link"><code>enableServer: boolean</code></a></li><li><a href="#enablenativeapi-boolean" class="table-of-contents__link"><code>enableNativeAPI: boolean</code></a></li><li><a href="#tokensecurity-string" class="table-of-contents__link"><code>tokenSecurity: string</code></a></li><li><a href="#url-string" class="table-of-contents__link"><code>url: string</code></a></li><li><a href="#documentroot-string" class="table-of-contents__link"><code>documentRoot: string</code></a></li><li><a href="#exportauthinfo-boolean" class="table-of-contents__link"><code>exportAuthInfo: boolean</code></a></li><li><a href="#enableextensions-boolean" class="table-of-contents__link"><code>enableExtensions: boolean</code></a></li><li><a href="#extensions-object" class="table-of-contents__link"><code>extensions: object[]</code></a></li><li><a href="#nativeblocklist-string" class="table-of-contents__link"><code>nativeBlockList: string[]</code></a></li><li><a href="#nativeallowlist-string" class="table-of-contents__link"><code>nativeAllowList: string[]</code></a></li><li><a href="#globalvariables-object" class="table-of-contents__link"><code>globalVariables: object</code></a></li><li><a href="#loggingenabled-boolean" class="table-of-contents__link"><code>logging.enabled: boolean</code></a></li><li><a href="#loggingwritetologfile-boolean" class="table-of-contents__link"><code>logging.writeToLogFile: boolean</code></a></li><li><a href="#serverheaders-object" class="table-of-contents__link"><code>serverHeaders: object</code></a></li></ul></li><li><a href="#window-mode" class="table-of-contents__link">Window mode</a><ul><li><a href="#modeswindowtitle-string" class="table-of-contents__link"><code>modes.window.title: string</code></a></li><li><a href="#modeswindowwidth-number" class="table-of-contents__link"><code>modes.window.width: number</code></a></li><li><a href="#modeswindowheight-number" class="table-of-contents__link"><code>modes.window.height: number</code></a></li><li><a href="#modeswindowminwidth-number" class="table-of-contents__link"><code>modes.window.minWidth: number</code></a></li><li><a href="#modeswindowminheight-number" class="table-of-contents__link"><code>modes.window.minHeight: number</code></a></li><li><a href="#modeswindowmaxwidth-number" class="table-of-contents__link"><code>modes.window.maxWidth: number</code></a></li><li><a href="#modeswindowmaxheight-number" class="table-of-contents__link"><code>modes.window.maxHeight: number</code></a></li><li><a href="#modeswindowx-number" class="table-of-contents__link"><code>modes.window.x: number</code></a></li><li><a href="#modeswindowy-number" class="table-of-contents__link"><code>modes.window.y: number</code></a></li><li><a href="#modeswindowcenter-boolean" class="table-of-contents__link"><code>modes.window.center: boolean</code></a></li><li><a href="#modeswindowfullscreen-boolean" class="table-of-contents__link"><code>modes.window.fullScreen: boolean</code></a></li><li><a href="#modeswindowicon-string" class="table-of-contents__link"><code>modes.window.icon: string</code></a></li><li><a href="#modeswindowalwaysontop-boolean" class="table-of-contents__link"><code>modes.window.alwaysOnTop: boolean</code></a></li><li><a href="#modeswindowenableinspector-boolean" class="table-of-contents__link"><code>modes.window.enableInspector: boolean</code></a></li><li><a href="#modeswindowborderless-boolean" class="table-of-contents__link"><code>modes.window.borderless: boolean</code></a></li><li><a href="#modeswindowmaximize-boolean" class="table-of-contents__link"><code>modes.window.maximize: boolean</code></a></li><li><a href="#modeswindowresizable-boolean" class="table-of-contents__link"><code>modes.window.resizable: boolean</code></a></li><li><a href="#modeswindowhidden-boolean" class="table-of-contents__link"><code>modes.window.hidden: boolean</code></a></li><li><a href="#modeswindowexitprocessonclose-boolean" class="table-of-contents__link"><code>modes.window.exitProcessOnClose: boolean</code></a></li><li><a href="#modeswindowusesavedstate-boolean" class="table-of-contents__link"><code>modes.window.useSavedState: boolean</code></a></li><li><a href="#modeswindowextenduseragentwith-string" class="table-of-contents__link"><code>modes.window.extendUserAgentWith: string</code></a></li></ul></li><li><a href="#chrome-mode" class="table-of-contents__link">Chrome mode</a><ul><li><a href="#modeschromewidth-number" class="table-of-contents__link"><code>modes.chrome.width: number</code></a></li><li><a href="#modeschromeheight-number" class="table-of-contents__link"><code>modes.chrome.height: number</code></a></li><li><a href="#modeschromeargs-string" class="table-of-contents__link"><code>modes.chrome.args: string</code></a></li></ul></li><li><a href="#cli" class="table-of-contents__link">CLI</a><ul><li><a href="#clibinaryname-string" class="table-of-contents__link"><code>cli.binaryName: string</code></a></li><li><a href="#cliresourcespath-string" class="table-of-contents__link"><code>cli.resourcesPath: string</code></a></li><li><a href="#cliextensionspath-string" class="table-of-contents__link"><code>cli.extensionsPath: string</code></a></li><li><a href="#cliclientlibrary-string" class="table-of-contents__link"><code>cli.clientLibrary: string</code></a></li><li><a href="#clibinaryversion-string" class="table-of-contents__link"><code>cli.binaryVersion: string</code></a></li><li><a href="#cliclientversion-string" class="table-of-contents__link"><code>cli.clientVersion: string</code></a></li><li><a href="#cliautoreloadexclude-string" class="table-of-contents__link"><code>cli.autoReloadExclude: string</code></a></li><li><a href="#clifrontendlibrary-object" class="table-of-contents__link"><code>cli.frontendLibrary: object</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container"><div class="row footer__links"><div class="col footer__col"><h4 class="footer__title">文档</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/zh-cn.neutralinojs.github.io/docs/">入门</a></li><li class="footer__item"><a class="footer__link-item" href="/zh-cn.neutralinojs.github.io/docs/api/overview">API参考</a></li><li class="footer__item"><a class="footer__link-item" href="/zh-cn.neutralinojs.github.io/docs/cli/neu-cli">CLI</a></li><li class="footer__item"><a class="footer__link-item" href="/zh-cn.neutralinojs.github.io/docs/configuration/modes">模式</a></li><li class="footer__item"><a class="footer__link-item" href="/zh-cn.neutralinojs.github.io/docs/contributing/framework-developer-guide">贡献</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">社区</h4><ul class="footer__items"><li class="footer__item"><a href="https://github.com/neutralinojs" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub</a></li><li class="footer__item"><a href="https://twitter.com/neutralinojs" target="_blank" rel="noopener noreferrer" class="footer__link-item">Twitter</a></li><li class="footer__item"><a href="https://stackoverflow.com/questions/tagged/neutralinojs" target="_blank" rel="noopener noreferrer" class="footer__link-item">Stack Overflow</a></li><li class="footer__item"><a href="https://medium.com/neutralinojs" target="_blank" rel="noopener noreferrer" class="footer__link-item">Medium</a></li><li class="footer__item"><a href="https://www.youtube.com/watch?v=txDlNNsgSh8&amp;list=PLvTbqpiPhQRb2xNQlwMs0uVV0IN8N-pKj&amp;ab_channel=CodeZri" target="_blank" rel="noopener noreferrer" class="footer__link-item">YouTube</a></li><li class="footer__item"><a href="https://join.slack.com/t/neutralinojs/shared_invite/zt-b7mbivj5-pKpO6U5drmeT68vKD_pc6w" target="_blank" rel="noopener noreferrer" class="footer__link-item">Slack</a></li><li class="footer__item"><a href="https://discord.gg/cybpp4guTJ" target="_blank" rel="noopener noreferrer" class="footer__link-item">Discord</a></li><li class="footer__item"><a href="https://www.reddit.com/r/neutralinojs/" target="_blank" rel="noopener noreferrer" class="footer__link-item">Reddit</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">更多</h4><ul class="footer__items"><li class="footer__item"><a href="https://github.com/neutralinojs/neutralinojs" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub</a></li><li class="footer__item"><a href="https://www.patreon.com/shalithasuranga" target="_blank" rel="noopener noreferrer" class="footer__link-item">Patreon</a></li><li class="footer__item"><a class="footer__link-item" href="/zh-cn.neutralinojs.github.io/privacy-policy">隐私政策</a></li><li class="footer__item"><a href="https://codezri.org/blog/" target="_blank" rel="noopener noreferrer" class="footer__link-item">博客</a></li></ul></div></div><div class="footer__bottom text--center"><div class="footer__copyright">Copyright © 2024 Neutralinojs | innovation by <a href="https://codezri.org/">CodeZri.org</a></div></div></div></footer></div>
<script src="/zh-cn.neutralinojs.github.io/assets/js/styles.c25d7c9f.js"></script>
<script src="/zh-cn.neutralinojs.github.io/assets/js/runtime~main.da1bdab8.js"></script>
<script src="/zh-cn.neutralinojs.github.io/assets/js/main.22927eab.js"></script>
<script src="/zh-cn.neutralinojs.github.io/assets/js/1.a80d899d.js"></script>
<script src="/zh-cn.neutralinojs.github.io/assets/js/2.818fc9a7.js"></script>
<script src="/zh-cn.neutralinojs.github.io/assets/js/49.8e895b96.js"></script>
<script src="/zh-cn.neutralinojs.github.io/assets/js/50.816652b0.js"></script>
<script src="/zh-cn.neutralinojs.github.io/assets/js/935f2afb.a67ede05.js"></script>
<script src="/zh-cn.neutralinojs.github.io/assets/js/17896441.74f92a0c.js"></script>
<script src="/zh-cn.neutralinojs.github.io/assets/js/dffd476c.dd877da1.js"></script>
</body>
</html>